<?xml version="1.0" encoding="utf-8" ?>
<Mapping xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<Entity type="ValueTypes" table="Entity" discriminator-field="Type" discriminator-value="ValueTypes">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="decimal" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="decimal" />
		<Attribute name="uint" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="uint" />
		<Attribute name="byte" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="byte" />
		<Attribute name="ulong" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="ulong" />
		<Attribute name="string" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="string" />
		<Attribute name="int" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="int" />
		<Attribute name="ushort" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="ushort" />
		<Attribute name="bool" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="bool" />
		<Attribute name="double" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="double" />
		<Attribute name="sbyte" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="sbyte" />
		<Attribute name="long" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="long" />
		<Attribute name="short" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="short" />
		<Attribute name="float" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="float" />
		<Attribute name="char" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="char" />
		<Attribute name="object" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="object" />
		<Attribute name="object2" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="object2" />
	</Entity>
	<Entity type="Address" table="Entity" discriminator-field="Type" discriminator-value="Address">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="City" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="City" />
	</Entity>
	<Entity type="Employee" table="Entity" discriminator-field="Type" discriminator-value="Employee">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Age" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Age" />
		<Attribute name="Lastname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Lastname" />
		<Attribute name="Firstname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Firstname" />
		<Attribute name="Acceleration" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Acceleration" />
		<Attribute name="Salary" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Salary" />
	</Entity>
	<Entity type="Worker" table="Entity" discriminator-field="Type" discriminator-value="Worker">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Age" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Age" />
		<Attribute name="Lastname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Lastname" />
		<Attribute name="Firstname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Firstname" />
		<Attribute name="Acceleration" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Acceleration" />
		<Attribute name="Salary" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Salary" />
		<Attribute name="Place" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Place" />
	</Entity>
	<Entity type="Secretary" table="Entity" discriminator-field="Type" discriminator-value="Secretary">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Age" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Age" />
		<Attribute name="Lastname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Lastname" />
		<Attribute name="Firstname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Firstname" />
		<Attribute name="Acceleration" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Acceleration" />
		<Attribute name="Salary" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Salary" />
		<Attribute name="Bonus" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Bonus" />
	</Entity>
	<Entity type="Person" table="Entity" discriminator-field="Type" discriminator-value="Person">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Age" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Age" />
		<Attribute name="Lastname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Lastname" />
		<Attribute name="Firstname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Firstname" />
		<Attribute name="Acceleration" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Acceleration" />
		<Reference name="Prout" entityChild="Person" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
		<Reference name="Address" entityChild="Address" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
		<Reference name="Brother" entityChild="Person" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
		<Reference name="Partners" entityChild="Person" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
		<Reference name="Friends" entityChild="Thing" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
		<Reference name="BestFriend" entityChild="Person">
			<Rule parentField="FK_BestFriend" childTable="Person" childField="PersonId" />
		</Reference>
		<Reference name="MyCompany" entityChild="Company" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
	</Entity>
	<Entity type="Thing" table="Entity" discriminator-field="Type" discriminator-value="Thing">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Lastname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Lastname" />
		<Attribute name="Firstname" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Firstname" />
	</Entity>
	<Entity type="FlaggedCategory" table="Entity" discriminator-field="Type" discriminator-value="FlaggedCategory">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="FlaggedCategory" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="FlaggedCategory" />
	</Entity>
	<Entity type="Category" table="Entity" discriminator-field="Type" discriminator-value="Category">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Category" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="Category" />
	</Entity>
	<Entity type="ComplexTypes" table="Entity" discriminator-field="Type" discriminator-value="ComplexTypes">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="array2" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="array2" />
		<Attribute name="array1" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="array1" />
		<Attribute name="datetime" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="datetime" />
		<Attribute name="timespan" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="timespan" />
	</Entity>
	<Entity type="SerializableTypes" table="Entity" discriminator-field="Type" discriminator-value="SerializableTypes">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="StringCollection" table="Attribute" field="Value" db-type="AnsiString" size="1024"
			parentField="FK_Entity" discriminator-field="Name" discriminator-value="StringCollection" />
	</Entity>
	<Entity type="Manager" table="Entity" discriminator-field="Type" discriminator-value="Manager">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Reference name="MyCompany" entityChild="Company" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
	</Entity>
	<Entity type="Company" table="Entity" discriminator-field="Type" discriminator-value="Company">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="Name" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
	</Entity>
	
	<!-- Test for "abstract" class -->
	
	<Entity type="B" table="Entity" discriminator-field="Type" discriminator-value="B">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="a" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="a" />
		<Attribute name="b" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="b" />
	</Entity>
	<Entity type="C" table="Entity" discriminator-field="Type" discriminator-value="C">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="a" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="a" />
		<Attribute name="c" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="c" />
	</Entity>
	
	<!-- Test for references inheritance -->
	
	<Entity type="Test:D" table="Entity" discriminator-field="Type" discriminator-value="C">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="d" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="d" />
		<Reference name="Refs" entityChild="Test:E" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
	</Entity>
	
	<Entity type="Test:D_Sub" table="Entity" discriminator-field="Type" discriminator-value="Test:D_Sub">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="d" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="d" />
		<Attribute name="dp" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="dp" />
			
		<Reference name="Refs" entityChild="Test:E" discriminator-field="Role">
			<Rule parentField="Id" childTable="Reference" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Entity" childField="Id" />
		</Reference>
	</Entity>
	
	<Entity type="Test:E" table="Entity" discriminator-field="Type" discriminator-value="Test:E">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="e" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
	</Entity>
	
	<Entity type="Test:F" table="Entity" discriminator-field="Type" discriminator-value="Test:F">
		<Id field="Id">
			<Generator name="guid" />
		</Id>
		<Attribute name="e" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="e" />
		<Attribute name="f" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="f" />
	</Entity>
	
	<Entity type="Test:G" table="Entity" discriminator-field="Type" discriminator-value="Test:G">
		<Id field="Id" >
			<Generator name="guid" />
		</Id>
		<Attribute name="e" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="e" />
		<Attribute name="f" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="f" />
		<Attribute name="g" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="g" />
	</Entity>
	
	<!-- Test for linked references : pe.Load("X.YRef.ZRef") -->
	<Entity type="X" table="X">
		<Id field="XId">
			<Generator name="guid" />
		</Id>
		<Attribute name="*" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
		<Reference name="YRef" entityChild="Y">
			<Rule parentField="XId" childTable="IndexTable3" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Y" childField="YId" />
		</Reference>
	</Entity>
	<Entity type="Y" table="Y">
		<Id field="YId">
			<Generator name="guid" />
		</Id>
		<Attribute name="*" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
		<Reference name="ZRef" entityChild="Z">
			<Rule parentField="YId" childTable="IndexTable3" childField="FK_Parent" />
			<Rule parentField="FK_Child" childTable="Z" childField="ZId" />
		</Reference>
	</Entity>
	<Entity type="Z" table="Z">
		<Id field="ZId">
			<Generator name="guid" />
		</Id>
		<Attribute name="*" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
	</Entity>
	<!-- Carole's bug -->
	<Entity type="Test:Contract" table="Test_Contract">
		<Id field="ContractId">
			<Generator name="guid" />
		</Id>
		<Attribute name="*" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
		<Reference name="MyCompany" entityChild="Test:Company">
			<Rule parentField="CompanyId" childTable="Test_Company" childField="CompanyId" />
		</Reference>
	</Entity>
	<Entity type="Test:Company" table="Test_Company">
		<Id field="ContractId">
			<Generator name="guid" />
		</Id>
		<Attribute name="*" table="Attribute" field="Value" db-type="AnsiString" size="1024" parentField="FK_Entity"
			discriminator="Name" discriminator-value="Name" />
	</Entity>
</Mapping>